package sing.rabbit.direct.consumer.consume;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import static sing.rabbit.direct.common.DirectConfigurations.*;

/**
 * 使用 @Component + @RabbitListener 方式 <br>
 *
 * 且 @RabbitListener 注解使用 queue 参数指定队列
 *
 * @author xing
 * @date 2022/9/8 8:13
 */
@Profile("sample_2")
@Component

public class DirectQueueListener2 {

    @RabbitListener(queues = DIRECT_QUEUE_NAME_1)
    public void consume(Message message) {
        System.out.println("get message: " + message);
    }
}
